import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AdmissionProcessQuery, AdmissionProcessForm, AdmissionProcessVO } from './types';

// 查询入住流程记录列表
export function listAdmissionProcess(query?: AdmissionProcessQuery): AxiosPromise<any> {
  return request({
    url: '/nursing/admissionProcess/list',
    method: 'get',
    params: query
  });
}

// 查询入住流程记录详细
export function getAdmissionProcess(processId: string | number): AxiosPromise<any> {
  return request({
    url: `/nursing/admissionProcess/${processId}`,
    method: 'get'
  });
}

// 新增入住流程记录
export function addAdmissionProcess(data: AdmissionProcessForm): AxiosPromise<any> {
  return request({
    url: '/nursing/admissionProcess',
    method: 'post',
    data: data
  });
}

// 修改入住流程记录
export function updateAdmissionProcess(data: AdmissionProcessForm): AxiosPromise<any> {
  return request({
    url: '/nursing/admissionProcess',
    method: 'put',
    data: data
  });
}

// 删除入住流程记录
export function delAdmissionProcess(processId: string | number | Array<string | number>): AxiosPromise<any> {
  return request({
    url: `/nursing/admissionProcess/${processId instanceof Array ? processId.join(',') : processId}`,
    method: 'delete'
  });
}

// 导出入住流程记录
export function exportAdmissionProcess(query?: AdmissionProcessQuery): AxiosPromise<any> {
  return request({
    url: '/nursing/admissionProcess/export',
    method: 'post',
    params: query
  });
}

// 审核入住流程记录
export function reviewAdmissionProcess(processId: string | number, reviewStatus: string, reviewComments?: string): AxiosPromise<any> {
  return request({
    url: `/nursing/admissionProcess/review/${processId}`,
    method: 'post',
    params: {
      reviewStatus,
      reviewComments
    }
  });
}
